﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Text;
using netDxf;
using netDxf.Blocks;
using netDxf.Collections;
using netDxf.Entities;
using netDxf.Header;
using netDxf.Objects;
using netDxf.Tables;
using netDxf.Units;
using Attribute = netDxf.Entities.Attribute;
using Image = netDxf.Entities.Image;
using Point = netDxf.Entities.Point;
using Trace = netDxf.Entities.Trace;
using System.Threading;

namespace TestDxfDocument
{

    class _Polygonaltaperinterfacewithflangecontactsurface
    {
        public static void _PolygonaltaperinterfacewithflangecontactsurfaceFineshankedtaps(Dictionary<string, Object> data)//细柄丝锥
        {
            DxfDocument dxf = new DxfDocument();
            //图层
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中心线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan };    //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层


            //参数
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);



            double scale = 1; //放大系数

            double dc = 63 * scale;
            double b1 = 70.7 * scale;
            double b2 = 55.8 * scale;
            double b3 = 55.4 * scale;
            double b4 = 85 * scale;
            double b5 = 9 * scale;
            double b6 = 3.5 * scale;
            double b7 = 4.1 * scale;
            double b8 = 2 * scale;
            double d1 = 63 * scale;
            double d2 = 28 * scale;
            double d3 = 32 * scale;
            double d4 = 20 * scale;
            double d5 = 8.1 * scale;
            double d6 = 20.5 * scale;
            double d7 = 48.5 * scale;
            double d8 = 44.9 * scale;
            double d9 = 4 * scale;
            double d10 = 4 * scale;
            double d11 = 7 * scale;
            double Dm = 44 * scale;
            double e = 1.4 * scale;
            double f1 = 0.5 * scale;
            double h1 = 18 * scale;
            double h2 = 17.5 * scale;
            double h3 = 5 * scale;
            double l1 = 3 * scale;
            double l2 = 38 * scale;
            double l3 = 22 * scale;
            double l4 = 1.5 * scale;
            double l5 = 6.2 * scale;
            double l6 = 12 * scale;
            double l7 = 11 * scale;
            double l8 = 9 * scale;
            double l9 = 12 * scale;
            double l10 = 15.5 * scale;
            double l11 = 26 * scale;
            double l12 = 5.8 * scale;
            double l13 = 6.5 * scale;
            double l14 = 0.6 * scale;
            double l15 = 1.6 * scale;
            double l16 = 12 * scale;
            double r1 = 5 * scale;
            double r2 = 0.5 * scale;
            double r3 = 2 * scale;

            //坐标
            Vector2 v1 = new Vector2(0, 0);
            Vector2 v2 = new Vector2(v1.X - (d1 / 2 + 2) / Math.Sin(45 * pi / 180), v1.Y);
            Vector2 v3 = new Vector2(v1.X + (d1 / 2 + 2) / Math.Sin(45 * pi / 180), v1.Y);
            Vector2 v4 = new Vector2(v3.X + 1 / 8 * d1, v3.Y);
            Vector2 v5 = new Vector2(v1.X, v1.Y - (d1 / 2 + 2) / Math.Sin(45 * pi / 180));
            Vector2 v6 = new Vector2(v1.X, v1.Y + (d1 / 2 + 2) / Math.Sin(45 * pi / 180));
            Vector2 v7 = fun.Polar(v3, 45 * pi / 180, 1 / 8 * d1);
            Vector2 v8 = fun.Polar(v3, -45 * pi / 180, 1 / 8 * d1);
            Vector2 v9 = fun.Polar(v5, -135 * pi / 180, 1 / 8 * d1);
            Vector2 v10 = fun.Polar(v2, -135 * pi / 180, 1 / 8 * d1);
            Vector2 v11 = fun.Polar(v2, 135 * pi / 180, 1 / 8 * d1);
            Vector2 v12 = fun.Polar(v6, 45 * pi / 180, 1 / 8 * d1);
            Vector2 v13 = fun.Polar(v6, 135 * pi / 180, 1 / 8 * d1);
            Vector2 v14 = fun.Polar(v1, -118 * pi / 180, 0.323 * d1);
            Vector2 v15 = fun.Polar(v14, 126 * pi / 180, 0.292 * d1);
            Vector2 v16 = fun.Polar(v15, 60 * pi / 180, 0.417 * d1);
            Vector2 v17 = fun.Polar(v16, 1 * pi / 180, 0.227 * d1);
            Vector2 v18 = fun.Polar(v17, -55 * pi / 180, 0.364 * d1);
            Vector2 v19 = fun.Polar(v18, -108 * pi / 180, 0.273 * d1);
            Vector2 v20 = fun.Polar(v1, -118 * pi / 180, 0.323 * d1 * 1.077);
            Vector2 v21 = fun.Polar(v20, 126 * pi / 180, 0.292 * d1 * 1.075);
            Vector2 v22 = fun.Polar(v21, 60 * pi / 180, 0.417 * d1 * 1.076);
            Vector2 v23 = fun.Polar(v1, 1 * pi / 180, 0.227 * d1 * 1.076);
            Vector2 v24 = fun.Polar(v17, -55 * pi / 180, 0.364 * d1 * 0.176);
            Vector2 v25 = fun.Polar(v18, -108 * pi / 180, 0.273 * d1 * 0.176);
            Vector2 v26 = fun.Polar(v1, 161 * pi / 180, 1 / 2 * d1);
            Vector2 v27 = fun.Polar(v1, 108 * pi / 180, 1 / 2 * d1);
            Vector2 v28 = fun.Polar(v1, 71 * pi / 108, 1 / 2 * d1);
            Vector2 v29 = fun.Polar(v1, 18 * pi / 180, 1 / 2 * d1);
            Vector2 v30 = fun.Polar(v1, -19 * pi / 180, 1 / 2 * d1);
            Vector2 v31 = fun.Polar(v1, -72 * pi / 180, 1 / 2 * d1);
            Vector2 v32 = fun.Polar(v1, -109 * pi / 180, 1 / 2 * d1);
            Vector2 v33 = fun.Polar(v1, -162 * pi / 180, 1 / 2 * d1);
            Vector2 v34 = new Vector2(v13.X / 2, v13.Y + 7/8 * d4);
            Vector2 v35 = new Vector2(v34.X * -1, v34.Y);
            Vector2 v36 = new Vector2(v35.X, v35.Y - d1 / 2);
            Vector2 v37 = new Vector2(v34.X, v36.Y);
            Vector2 v38 = new Vector2(v11.X, v11.Y / 2);
            Vector2 v39 =new Vector2 (vs)







        }

    }
}
